﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace VASMide
{
    public partial class vmdebug : Form
    {
        public vmdebug()
        {
            InitializeComponent();
        }
        public void refresh()
        {
            DA += Form1.vm.InstructionDA + "\n"; ;
            memalloc.Text = Form1.vm.memory.buffer.Length.ToString();
            instruction.Text = "0x" + Form1.vm.Instruction.ToString("X");
            instructionptr.Text = "0x" + Form1.vm.InstructionPointer.ToString("X");
            memfree.Text = (Form1.vm.memory.buffer.Length - Form1.vm.vi).ToString() + " bytes";
            if (DA != richTextBox1.Text)
            {
                richTextBox1.Text = DA;
                richTextBox1.SelectionStart = DA.Length;
            }
            listBox1.Items.Clear();
            foreach (object s in Form1.vm.Stack)
            {
                listBox1.Items.Add(s.ToString());
            }
           
        }
        string DA = "";
        private void vmdebug_Load(object sender, EventArgs e)
        {
            timer1.Start();
            //Form1.vm.nextOpcode += new viperv3.ViperVirtualMachine.NextOpcodeChange(refresh);
        }
        int mpos = 999999;
        private void timer1_Tick(object sender, EventArgs e)
        {
            
            
            
        }
    }
}
